package com.luo.chengrui.module.crbpm.dal.mysql.orgdefinition;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import com.luo.chengrui.module.crbpm.dal.dataobject.orgdefinition.BpmOrgDefinitionDO;
import org.apache.ibatis.annotations.Mapper;
import com.luo.chengrui.module.crbpm.controller.admin.orgdefinition.vo.*;

/**
 * 组织机构流程，定义各组织内部可发起的流程类型。  Mapper
 *
 * @author luodz
 */
@Mapper
public interface BpmOrgDefinitionMapper extends BaseMapperX<BpmOrgDefinitionDO> {

    default PageResult<BpmOrgDefinitionDO> selectPage(BpmOrgDefinitionPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<BpmOrgDefinitionDO>()
                .likeIfPresent(BpmOrgDefinitionDO::getName, reqVO.getName())
                .eqIfPresent(BpmOrgDefinitionDO::getOrgId, reqVO.getOrgId())
                .eqIfPresent(BpmOrgDefinitionDO::getStatus, reqVO.getStatus())
                .eqIfPresent(BpmOrgDefinitionDO::getVersion, reqVO.getVersion())
                .betweenIfPresent(BpmOrgDefinitionDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(BpmOrgDefinitionDO::getId));
    }

    default List<BpmOrgDefinitionDO> selectList(BpmOrgDefinitionExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<BpmOrgDefinitionDO>()
                .likeIfPresent(BpmOrgDefinitionDO::getName, reqVO.getName())
                .eqIfPresent(BpmOrgDefinitionDO::getOrgId, reqVO.getOrgId())
                .eqIfPresent(BpmOrgDefinitionDO::getStatus, reqVO.getStatus())
                .eqIfPresent(BpmOrgDefinitionDO::getVersion, reqVO.getVersion())
                .betweenIfPresent(BpmOrgDefinitionDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(BpmOrgDefinitionDO::getId));
    }

}
